Execute kubernetes deployment file:
kubectl create -f jupyter-notebook-deployment.yaml
File: https://github.com/xjantoth/helmfile-course/blob/master/jupyter-notebook-deployment.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter-k8s-udemy
labels:
app: jupyter-k8s-udemy
spec:
replicas: 1
selector:
matchLabels:
app: jupyter-k8s-udemy
template:
metadata:
labels:
app: jupyter-k8s-udemy
spec:
containers:
- name: minimal-notebook
image: jupyter/scipy-notebook:2c80cf3537ca
ports:
- containerPort: 8888
command: ["start-notebook.sh"]
args: ["--NotebookApp.token=''"]
Execute _kubernetes service_ **file**:
```bash
kubectl create -f jupyter-notebook-service.yamlFile: https://github.com/xjantoth/helmfile-course/blob/master/jupyter-notebook-service.yaml
---
kind: Service
apiVersion: v1
metadata:
name: jupyter-k8s-udemy
spec:
type: NodePort
selector:
app: jupyter-k8s-udemy
ports:
- protocol: TCP
nodePort: 30040
port: 8888
targetPort: 8888kubectl get nodes -o wide | awk -F" " '{print $1"\t"$7}'
NAME EXTERNAL-IP
ip-172-20-34-241.eu-central-1.compute.internal 18.184.212.193
ip-172-20-50-50.eu-central-1.compute.internal 3.120.179.150
ip-172-20-52-232.eu-central-1.compute.internal 18.196.157.47SSH to your AWS EC2 instances if neceassary
ssh -i ~/.ssh/udemy_devopsinuse admin@18.184.212.193 ssh -i ~/.ssh/udemy_devopsinuse admin@3.120.179.150 ssh -i ~/.ssh/udemy_devopsinuse admin@18.196.157.47
Run command netstat -tunlp | grep 30040 at each of the EC2 instances to see that NodePort type of kubernetes service results in exposing this port at each physical EC2 within your Kubernetes cluster in AWS
ssh -i ~/.ssh/udemy_devopsinuse admin@18.184.212.193 netstat -tunlp | grep 30040 ssh -i ~/.ssh/udemy_devopsinuse admin@3.120.179.150 netstat -tunlp | grep 30040 ssh -i ~/.ssh/udemy_devopsinuse admin@18.196.157.47 netstat -tunlp | grep 30040